﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chatter.CoreServer
{
    /// <summary>
    /// Classe qui défini un salon sur le chat
    /// </summary>
    public class ChatRoom
    {
        private string _name;
        /// <summary>
        /// Nom du salon
        /// </summary>
        public string name
        {
            get { return this._name; }
            set { this._name = value; }
        }

        private List<ClientManager> _clients;
        /// <summary>
        /// Liste des utilisateurs connectés au salon
        /// </summary>
        public List<ClientManager> clients
        {
            get { return this._clients; }
            set { this._clients = value; }
        }

        private RoomType _type;
        /// <summary>
        /// Type de salon : Temporaire, Permanent
        /// </summary>
        public RoomType type
        {
            get { return this._type; }
            set { this._type = value; }
        }

        private bool _pwdProtected;
        /// <summary>
        /// Salon protégé par mot de passe ?
        /// </summary>
        public bool pwdProtected
        {
            get { return _pwdProtected; }
            set { _pwdProtected = value; }
        }

        private string _password;
        /// <summary>
        /// Mot de passe du salon
        /// </summary>
        public string password
        {
            get { return this._password; }
            set { this._password = value; }
        }

        private bool _locked;
        /// <summary>
        /// Salon vérouillé ? (personne ne peut entrer)
        /// </summary>
        public bool locked
        {
            get { return this._locked; }
            set { this._locked = value; }
        }

        /// <summary>
        /// Constructeur qui initialise les différents attributs du salon
        /// </summary>
        /// <param name="name">Nom</param>
        /// <param name="type">Type de salon : Temporaire, Permanent</param>
        /// <param name="pwdProtected">Protégé par mot de passe ?</param>
        /// <param name="pwd">Mot de passe</param>
        /// <param name="locked">Salon vérouillé ?</param>
        public ChatRoom(string name, RoomType type, bool pwdProtected, string pwd="", bool locked=false)
        {
            this._name = name;
            this._clients = new List<ClientManager>();
            this._type = type;
            this._pwdProtected = pwdProtected;
            this._password = pwd;
            this._locked = locked;
        }
    }
}
